<template>
	<view>
		<view class="search_flex">
			<view class="search">
				<image class="ico" src="../../static/ico_ss.png" mode="widthFix"></image>
				<input class="input" placeholder-class="placeholder" v-model="keyword" type="text" placeholder="搜索线索名字/手机号" />
			</view>
			<view class="btn_screen" @click="openScreen">
				<image class="ico" src="../../static/ico_s1.png" mode="widthFix"></image>
				<view class="text">筛选</view>
			</view>
		</view>
		
		<view class="clue_list">
			<view class="item" @click="gotoInfo">
				<image class="ph" src="../../static/ico_head.png" mode="aspectFill"></image>
				<view class="info">
					<view class="title">
						<view class="name">
							王瑞琛
						</view>
						<view class="tag_red">
							高
						</view>
					</view>
					<view class="source">
						学生来源：门店咨询
					</view>
					<view class="time">
						最后跟进时间：2024-04-12 08:11
					</view>
				</view>
				<view class="state red">
					未分配
				</view>
			</view>
			<view class="item" @click="gotoInfo">
				<image class="ph" src="../../static/ico_head.png" mode="aspectFill"></image>
				<view class="info">
					<view class="title">
						<view class="name">
							王瑞琛
						</view>
						<view class="tag_yellow">
							中
						</view>
					</view>
					<view class="source">
						学生来源：门店咨询
					</view>
					<view class="time">
						最后跟进时间：2024-04-12 08:11
					</view>
				</view>
				<view class="state org">
					跟进中
				</view>
			</view>
			<view class="item" @click="gotoInfo">
				<image class="ph" src="../../static/ico_head.png" mode="aspectFill"></image>
				<view class="info">
					<view class="title">
						<view class="name">
							王瑞琛
						</view>
						<view class="tag_gray">
							低
						</view>
					</view>
					<view class="source">
						学生来源：门店咨询
					</view>
					<view class="time">
						最后跟进时间：2024-04-12 08:11
					</view>
				</view>
				<view class="state blue">
					待跟进
				</view>
			</view>
			<view class="item" @click="gotoInfo">
				<image class="ph" src="../../static/ico_head.png" mode="aspectFill"></image>
				<view class="info">
					<view class="title">
						<view class="name">
							王瑞琛
						</view>
						<view class="tag_gray">
							低
						</view>
					</view>
					<view class="source">
						学生来源：门店咨询
					</view>
					<view class="time">
						最后跟进时间：2024-04-12 08:11
					</view>
				</view>
				<view class="state blue">
					已成交
				</view>
			</view>
		</view>
		
		<navigator url="/pages/addClue/addClue" hover-class="none">
			<image class="ico_add" src="../../static/ico_7.png" mode="widthFix"></image>
		</navigator>
		
		<uv-popup ref="popup" mode="right"  :safeAreaInsetBottom="true" @change="changeScreen">
			<view class="screen_popup">
				<view class="title">
					筛选
				</view>
				<view class="screen_list">
					<view class="screen_item">
						<view class="name">
							跟进状态
						</view>
						<view class="select">
							<view class="item" v-for="(item,index) in status" :class="statusIndex == index?'hover':''" :key="index" @click="clickStatus(index)">
								{{item}}
							</view>
						</view>
					</view>
					<view class="screen_item">
						<view class="name">
							跟进阶段
						</view>
						<view class="select">
							<view class="item" v-for="(item,index) in stage" :class="stageIndex == index?'hover':''" :key="index" @click="clickStage(index)">
								{{item}}
							</view>
						</view>
					</view>
					
					<view class="screen_item">
						<view class="name">
							最后跟进时间
						</view>
						<view class="follow_time" @click="openRangeTime">
							<input class="input" type="text" v-model="startTime" :disabled="true" placeholder="开始时间" />
							<view class="ico">-</view>
							<input class="input" type="text" v-model="endTime" :disabled="true" placeholder="结束时间" />
						</view>
					</view>
					<view class="screen_item2" @click="openPicker">
						<view class="name">
							班级老师
						</view>
						<view class="picker">
							<text>请选择</text>
							<uv-icon name="arrow-right" color="#BEBEBE" size="24rpx"></uv-icon>
						</view>
					</view>
					<view class="screen_item2" @click="openPicker">
						<view class="name">
							标签
						</view>
						<view class="picker">
							<text>请选择</text>
							<uv-icon name="arrow-right" color="#BEBEBE" size="24rpx"></uv-icon>
						</view>
					</view>
					
					<view class="screen_item">
						<view class="name">
							意向级别
						</view>
						<view class="select">
							<view class="item" v-for="(item,index) in intention" :class="intentIndex == index?'hover':''" :key="index" @click="clickIntent(index)">
								{{item}}
							</view>
						</view>
					</view>
					
				</view>
				
				<view class="screen_btn">
					<view class="btn_white">
						重置
					</view>
					<view class="btn_org">
						完成
					</view>
				</view>
			</view>
		</uv-popup>
		
		<uv-popup ref="popupCalendars" mode="bottom" zIndex='10076'>
			<view class="calendars_title">
				<view class="" @click="closeRangeTime">
					取消
				</view>
				<view class="" @click="confirmRangeTime">
					确定
				</view>
			</view>
			<uv-calendars ref="calendars" mode="range" :insert="true" @change="changeRangeTime"/>
		</uv-popup>
		
		<uv-picker ref="picker" :columns="columnsPicker" @confirm="confirmPicker"></uv-picker>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				keyword: '',
				status: ['待跟进','跟进中','已成交'],
				stage: ['建立联系','确认意向','承诺到访','预约试听','完成试听','完成缴费'],
				intention: ['高','中','低','未知'],
				startTime: '',
				endTime: '',
				columnsPicker: [
					['数据1','数据2','数据3']
				],
				statusIndex: -1,
				stageIndex: -1,
				intentIndex: -1
			}
		},
		onLoad() {

		},
		methods: {
			clickStatus(index){
				this.statusIndex = index
			},
			clickStage(index){
				this.stageIndex = index
			},
			clickIntent(index){
				this.intentIndex = index
			},
			closeRangeTime() {
				this.$refs.popupCalendars.close();
			},
			openRangeTime() {
				this.$refs.popupCalendars.open();
			},
			confirmRangeTime(e){
				if(!this.endTime){
					uni.showToast({
						title: '请选择日期范围',
						duration: 2000,
						icon:'none'
					});
					return
				}
				this.$refs.popupCalendars.close();
			},
			changeRangeTime(e){
				//console.log('-----------',e)
				this.startTime = e.range.before
				if(e.range.after){
					this.endTime = e.range.after
				}
			},
			gotoInfo(){
				uni.navigateTo({
					url: '/pages/clueInfo/clueInfo'
				});
			},
			openPicker() {
				this.$refs.picker.open();
			},
			confirmPicker(){
				
			},
			openScreen(){
				this.$refs.popup.open();
			},
			changeScreen(e){
				console.log('弹窗状态改变：',e);
			}
		}
	}
</script>

<style lang="scss" scoped>
.red{
	color: #FA5151;
}
.org{
	color: #FF8535;
}
.blue{
	color: #3378F5;
}
.calendars_title{
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 28rpx;
	line-height: 38rpx;
	padding:30rpx 40rpx 10rpx;
	color: #FF8535;
}
.follow_time{
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 20rpx;
	.ico{
		flex-shrink: 0;
		line-height: 30rpx;
		font-size: 30rpx;
		padding:0 10rpx;
	}
	.input{
		width: 100%;
		height: 60rpx;
		line-height: 60rpx;
		background: #F7F8FA;
		text-align: center;
		font-size: 28rpx;
		color: rgba(61, 61, 61, 0.8);
	}
}
.screen_popup{
	position: relative;
	width: 650rpx;
	height: 100%;
	background: #F7F8FA;
	display: block;
	flex-direction:column;
	overflow-y: auto;
	.title{
		flex-shrink: 0;
		text-align: center;
		background: #fff;
		font-size: 30rpx;
		color: #3D3D3D;
		line-height: 40rpx;
		padding:20rpx;
	}
	.screen_list{
		background: #fff;
		padding:0 0 15rpx;
	}
	.screen_item2{
		padding:40rpx 36rpx;
		border-bottom:1px solid rgba(230, 229, 231, 0.8);
		display: flex;
		align-items: center;
		justify-content: space-between;
		.picker{
			display: flex;
			align-items: center;
			color: #BEBEBE;
			font-size: 30rpx;
			line-height: 42rpx;
			text{
				padding-right: 8rpx;
			}
		}
	}
	.screen_item{
		padding:40rpx 36rpx;
		border-bottom:1px solid rgba(230, 229, 231, 0.8);
		.select{
			display: flex;
			align-items: center;
			justify-content: space-between;
			flex-wrap: wrap;
			.item{
				width: 270rpx;
				height: 60rpx;
				line-height: 60rpx;
				background: #F7F8FA;
				text-align: center;
				font-size: 28rpx;
				margin-top: 20rpx;
				color: rgba(61, 61, 61, 0.8);
				&.hover{
					color:#fff;
					background: #FF8535;
				}
			}
		}
		.name{
			flex-shrink: 0;
			font-size: 30rpx;
			color: #3D3D3D;
			line-height: 42rpx;
		}
		.picker{
			display: flex;
			align-items: center;
			color: #BEBEBE;
			font-size: 30rpx;
			line-height: 42rpx;
			text{
				padding-right: 8rpx;
			}
		}
	}
	.screen_btn{
		flex-shrink: 0;
		padding:15rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		.btn_white{
			width: 300rpx;
			height: 84rpx;
			line-height: 84rpx;
			text-align: center;
			background: #FFFFFF;
			box-sizing: border-box;
			border: 2rpx solid #FF8535;
			font-size: 28rpx;
			color: #FF8535;
		}
		.btn_org{
			width: 300rpx;
			height: 84rpx;
			line-height: 84rpx;
			text-align: center;
			background: #FF8535;
			color:#fff;
			font-size: 28rpx;
		}
	}
}
.ico_add{
	position: fixed;
	right: 40rpx;
	bottom: 180rpx;
	border-radius: 50%;
	width: 100rpx;
	height: 100rpx;
	box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.2);
}
.clue_list{
	background: #fff;
	.item{
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding:30rpx 40rpx;
		border-bottom:1px solid rgba(230, 229, 231, 0.8);
		.info{
			width: 100%;
			.title{
				display: flex;
				align-items: center;
				padding:4rpx 0;
				.name{
					font-size: 30rpx;
					font-weight: 500;
					line-height: 30rpx;
					color: #3D3D3D;
				}
				.tag_red{
					display: block;
					flex-shrink: 0;
					width: 30rpx;
					height: 30rpx;
					border-radius: 8rpx;
					background: rgba(255, 215, 237, 0.8);
					font-size: 20rpx;
					line-height: 30rpx;
					text-align: center;
					color: #FA5151;
					margin-left: 20rpx;
				}
				.tag_yellow{
					display: block;
					flex-shrink: 0;
					width: 30rpx;
					height: 30rpx;
					border-radius: 8rpx;
					background: #FFF8C6;
					font-size: 20rpx;
					line-height: 30rpx;
					text-align: center;
					color: #FF8F1F;
					margin-left: 20rpx;
				}
				.tag_gray{
					display: block;
					flex-shrink: 0;
					width: 30rpx;
					height: 30rpx;
					border-radius: 8rpx;
					background: rgba(230, 229, 231, 0.698);
					font-size: 20rpx;
					line-height: 30rpx;
					text-align: center;
					color: rgba(154, 154, 154, 1);
					margin-left: 20rpx;
				}
			}
			.source{
				padding-top: 8rpx;
				font-size: 24rpx;
				font-weight: normal;
				line-height: 38rpx;
				color: rgba(61, 61, 61, 0.6);
			}
			.time{
				font-size: 24rpx;
				font-weight: normal;
				line-height: 38rpx;
				color: rgba(61, 61, 61, 0.6);
			}
		}
		.ph{
			flex-shrink: 0;
			width: 112rpx;
			height: 112rpx;
			margin-right: 30rpx;
		}
		.state{
			flex-shrink: 0;
			font-size: 24rpx;
			font-weight: 500;
			line-height: 38rpx;
			margin-left: 20rpx;
		}
	}
}
.search_flex{
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding:20rpx 40rpx;
	border-bottom:1px solid rgba(230, 229, 231, 0.8);
	background: #fff;
	.search{
		width: 100%;
		height: 80rpx;
		background: #F7F7F9;
		display: flex;
		align-items: center;
		border-radius: 16rpx;
		padding:0 20rpx;
		.ico{
			flex-shrink: 0;
			width: 40rpx;
			height: 40rpx;
			margin-right: 15rpx;
			opacity: 0.8;
		}
		.input{
			display: block;
			width: 100%;
			background: none;
			border:none;
			font-size: 28rpx;
			color: #333;
			height: 40rpx;
			line-height: 40rpx;
		}
		.placeholder{
			color: #BEBEBE;
		}
	}
	.btn_screen{
		flex-shrink: 0;
		display: flex;
		align-items: center;
		padding:0 8rpx;
		margin-left: 20rpx;
		.ico{
			flex-shrink: 0;
			width: 30rpx;
			height: 32rpx;
			margin-right: 10rpx;
		}
		.text{
			color: #3D3D3D;
			font-size: 28rpx;
		}
	}
}
</style>
